<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>重新申请审批</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            background-color: #eef2f7;
        }
        .container {
            max-width: 900px;
            margin-top: 50px;
            background-color: #ffffff;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
        }
        h2 {
            color: #007bff;
            font-weight: bold;
            text-align: center;
            margin-bottom: 30px;
        }
        .form-label {
            font-weight: bold;
            color: #495057;
        }
        .form-control {
            border-radius: 8px;
            border: 1px solid #ced4da;
            box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
        }
        .form-control:focus {
            border-color: #007bff;
            box-shadow: 0px 0px 5px rgba(0, 123, 255, 0.5);
        }
        .btn-primary {
            background-color: #007bff;
            border: none;
            width: 100%;
            font-size: 16px;
            padding: 10px;
            border-radius: 8px;
            transition: background-color 0.3s ease;
        }
        .btn-primary:hover {
            background-color: #0056b3;
        }
        .btn-secondary {
            width: 100%;
            font-size: 16px;
            padding: 10px;
            border-radius: 8px;
        }
        .row {
            margin-bottom: 15px;
        }
    </style>
</head>
<body>
<div class="container">
    <h2>重新申请审批</h2>
    <form method="post">
        {% csrf_token %}
        {% if errors %}
            <div class="alert alert-danger">
                <ul>
                    {% for field, error in errors.items %}
                        <li>{{ field }}: {{ error|join:", " }}</li>
                    {% endfor %}
                </ul>
            </div>
        {% endif %}
        <div class="row">
            <!-- 渲染所有表单字段 -->
            {% for field in form %}
                {% if field.name != "operation_reason" %} <!-- 隐藏操作理由字段 -->
                    <div class="col-md-6 mb-3">
                        <label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
                        {{ field }}
                        {% if field.errors %}
                            <div class="text-danger small">{{ field.errors }}</div>
                        {% endif %}
                    </div>
                {% endif %}
            {% endfor %}
        </div>
        <!-- 重新申请理由 -->
        <div class="mb-3">
            <label for="operation_reason" class="form-label">重新申请理由</label>
            <textarea id="operation_reason" name="operation_reason" class="form-control" rows="3" placeholder="请输入重新申请理由" required></textarea>
        </div>
        <button type="submit" class="btn btn-primary">提交申请</button>
        <a href="{% url 'user_records_view' %}" class="btn btn-secondary mt-3">取消并返回</a>
    </form>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
